package cn.java81.jdbc;
import cn.java81.util.DbUtil;

import java.sql.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class StudentNums {

    public static void main(String[] args) {
        Connection con=null;
        Statement stmt = null;
        ResultSet rs = null;

        con=DbUtil.getConnection();
        try {
            stmt=con.createStatement();
            String select="select count(*) from s_student";
            rs=stmt.executeQuery(select);
            int count=0;
            if (rs.next()){
                count=rs.getInt(1);
            }
            System.out.println(count);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            DbUtil.close(rs);
            DbUtil.close(stmt);
            DbUtil.close(con);
        }
    }
}
